package com.itcam;

import java.util.Scanner;

/**
 * @author : Cammy.Wu
 * Description : 
 */

public class Demo02 {

    public static void main(String[] args) {
        try {
            Scanner scanner = new Scanner(System.in);

            System.out.println("请输入数字A：");
            double numberA = Double.parseDouble(scanner.nextLine());
            System.out.println("请选择运算符（+、-、*、/）");
            String Operation = scanner.nextLine();
            System.out.println("请输入数字B：");
            double numberB = Double.parseDouble(scanner.nextLine());
            double result = 0d;

            switch (Operation) {
                case "+":
                    result = numberA + numberB;
                    break;
                case "-":
                    result = numberA - numberB;
                    break;
                case "*":
                    result = numberA * numberB;
                    break;
                case "/":
                    result = numberA / numberB;
                    break;
            }
            System.out.println("结果是：" + result);
        } catch (NumberFormatException e) {
            System.out.println("输入有误" + e.toString());
        }
    }
}
